<%@page contentType="text/html" pageEncoding="UTF-8"%>
<jsp:useBean id="user" class="org.bsscheduler.User" scope="session" />

<%
        String action = request.getParameter("action");
        if (action == null) {
            action = "";
        }


// If user has asked to logout, do it here
        if (action.equals("logout")) {
            user.logout();
        }

// if logged in, go to user's main page
        if (user.getLoggedIn()) {%>
<jsp:forward page="main.jsp" />
<% }%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>BS Scheduler</title>
        <link rel="stylesheet" href="http://yui.yahooapis.com/2.7.0/build/reset-fonts-grids/reset-fonts-grids.css" type="text/css">
        <link rel="stylesheet" href="http://yui.yahooapis.com/2.7.0/build/reset-fonts-grids/reset-fonts-grids.css" type="text/css">
        <link REL=StyleSheet HREF="site.css" TYPE="text/css" MEDIA=screen>




        <script type="text/javascript" src="jquery.js"></script>
        <script type="text/javascript">
            // window.onload = function(){ alert("welcome"); }
            $(document).ready(function(){
                $("a")
                .filter(".clickme")
                .click(function(){
                    alert("You are now leaving the site.");
                })
                .end()
                .filter(".hideme")
                .click(function(){
                    $(this).hide();
                    return false;
                })
                .end();
            });



        </script>
    </head>
    <body>
        <div id="doc"> <!-- 950px width  -->
            <div id="hd" role="banner"><h1 class="login">Welcome to bsscheduler</h1>
            </div>
            <div id="bd" role="main" class ="login">

                <form name="login" action="checklogin.jsp" method="POST">

                    <fieldset class="login">
                        <legend class="login">login</legend>
                        <%
                        if (action.equals("badlogin")) {%>
                        <p class="alert">Invalid e-mail address or password</p>
                        <%} else if (action.equals("created")) {%>
                        <p class="notify">Your account has been created! You may now log in.</p>
                        <%}
                        %>
                        <p><label for="username" class="login">E-mail address:</label>
                        <input type="text" name="username" id="username" class="login"/></p>
                        <p><label for="password" class="login">Password:</label>
                        <input type="password" name="password" id="password" class="login" /></p>
                        <p><input type="submit" value="Login" class="login_submit" />
                        <p class="login_register">Not registered? <a href="register.jsp">Click here</a> to create an account.</p>

                    </fieldset>
                </form>

            </div>
            <div id="ft" role="contentinfo"></div>
        </div>



    </body>
</html>